<html>
<head><meta charset="utf-8"><title>Command-line config file · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Command-line.20config.20file.html">Command-line config file</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="247779075"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Command-line%20config%20file/near/247779075" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Command-line.20config.20file.html#247779075">(Jul 31 2021 at 01:52)</a>:</h4>
<p>When using <code>rust-analyzer</code> from the command line (<code>cargo run --release -p rust-analyzer</code>), how can I specify a config file? I want to override <code>rustcSource</code></p>



<a name="247783376"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Command-line%20config%20file/near/247783376" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Command-line.20config.20file.html#247783376">(Jul 31 2021 at 03:44)</a>:</h4>
<p>Are you using <code>analysis-stats</code>/<code>analysis-bench</code>?</p>



<a name="247811915"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Command-line%20config%20file/near/247811915" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Command-line.20config.20file.html#247811915">(Jul 31 2021 at 16:04)</a>:</h4>
<p>Yes</p>



<a name="247814507"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Command-line%20config%20file/near/247814507" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Command-line.20config.20file.html#247814507">(Jul 31 2021 at 17:04)</a>:</h4>
<p>Specifically, I was using <code>analysis-stats</code></p>



<a name="247815199"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Command-line%20config%20file/near/247815199" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Command-line.20config.20file.html#247815199">(Jul 31 2021 at 17:20)</a>:</h4>
<p>I don't think that's possible, sadly, we just use default config: <a href="https://github.com/rust-analyzer/rust-analyzer/blob/93873b0ce17ab4566c2345f9b5ce0cd88f69dce4/crates/rust-analyzer/src/cli/analysis_stats.rs#L67">https://github.com/rust-analyzer/rust-analyzer/blob/93873b0ce17ab4566c2345f9b5ce0cd88f69dce4/crates/rust-analyzer/src/cli/analysis_stats.rs#L67</a></p>



<a name="247815215"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Command-line%20config%20file/near/247815215" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Command-line.20config.20file.html#247815215">(Jul 31 2021 at 17:21)</a>:</h4>
<p>I'll just modify it in that file, then</p>



<a name="247815259"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Command-line%20config%20file/near/247815259" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Command-line.20config.20file.html#247815259">(Jul 31 2021 at 17:22)</a>:</h4>
<div class="codehilite" data-code-language="Diff"><pre><span></span><code><span class="gh">diff --git a/crates/rust-analyzer/src/cli/analysis_stats.rs b/crates/rust-analyzer/src/cli/analysis_stats.rs</span>
<span class="gh">index 37da24f30..d97495e4b 100644</span>
<span class="gd">--- a/crates/rust-analyzer/src/cli/analysis_stats.rs</span>
<span class="gi">+++ b/crates/rust-analyzer/src/cli/analysis_stats.rs</span>
<span class="gu">@@ -20,7 +20,7 @@ use ide_db::base_db::{</span>
 };
 use itertools::Itertools;
 use oorandom::Rand32;
<span class="gd">-use project_model::CargoConfig;</span>
<span class="gi">+use project_model::{CargoConfig, RustcSource};</span>
 use rayon::prelude::*;
 use rustc_hash::FxHashSet;
 use stdx::format_to;
<span class="gu">@@ -66,6 +66,7 @@ impl AnalysisStatsCmd {</span>
         let mut db_load_sw = self.stop_watch();
         let mut cargo_config = CargoConfig::default();
         cargo_config.no_sysroot = self.no_sysroot;
<span class="gi">+        cargo_config.rustc_source = Some(RustcSource::Path("rust-lang/rust".into()));</span>
         let load_cargo_config = LoadCargoConfig {
             load_out_dirs_from_check: self.enable_build_scripts,
             with_proc_macro: self.enable_proc_macros,
</code></pre></div>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>